package main

import (
	"fmt"
	"github.com/astaxie/beego"
	"payspace/models"
	_ "payspace/routers"
	"payspace/task"
)

func main() {

	// 配置database
	user := beego.AppConfig.String("myuser")
	pwd := beego.AppConfig.String("mypwd")
	addr := beego.AppConfig.String("mysql")
	database := beego.AppConfig.String("database")
	db := fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8&loc=Local", user, pwd, addr, database)

	// 设定日志
	//orm.Debug = true
	beego.SetLogger("file", `{"filename":"../logs/payspace.log"}`)

	//beego.BConfig.WebConfig.StaticDir["/swagger"] = "swagger"
	models.Init(db)
	task.Init()
	beego.Run()
}
